﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CutomizeValidation.aspx.cs"
    Inherits="V2Test.CutomizeValidation" %>

<%@ Register Assembly="Cwing.UI.Validation" Namespace="Cwing.UI.Controls" TagPrefix="cwvf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <cwvf:ValidationTextBox ID="ValidationTextBox1" runat="server" Path="//Control[@ID=&quot;Number&quot;]"
            ValidationType="Client" ValidationSummary="ErrorList1"></cwvf:ValidationTextBox>
    </div>
    <cwvf:ErrorList ID="ErrorList1" runat="server">
    </cwvf:ErrorList>
    <asp:Button ID="Button1" runat="server" Text="Validation" OnClientClick="javascript:v();return false;" />
    <br />
    <br />
    <br />
    <br />
    <asp:DropDownList ID="DropDownList1" runat="server">
        <asp:ListItem Value="Validate Pass">Validate Pass</asp:ListItem>
        <asp:ListItem Value="Validate Failure">Validate Failure</asp:ListItem>
    </asp:DropDownList>

    <script type="text/javascript">
        var customize = CW.Customize("<%=ErrorList1.ClientID %>");
        customize.Validate = function(r) {
            alert(r);
            if (r) document.getElementById("<%=DropDownList1.ClientID %>").value = "Validate Pass";
            else document.getElementById("<%=DropDownList1.ClientID %>").value = "Validate Failure";
            this.Message = "";
            this.ValidationResult = false;
        }
        var uniqueID = CW.AddCustomize(customize);

        function v() {
            CW.Validate();
        }
    </script>

    </form>
</body>
</html>
